
from time import sleep
from selenium import webdriver
from selenium.webdriver import ActionChains
from selenium.webdriver.common.by import By
from selenium.webdriver.support.wait import WebDriverWait

driver = webdriver.Chrome(executable_path='chromedriver.exe')
# # 2.输入访问地址（URL）
driver.get("http://121.43.169.97:8848/pageA.html")
# driver = webdriver.Chrome() #创建浏览器对象
# 放大浏览器页面
driver.maximize_window()

# # 设置隐式等待
driver.implicitly_wait(10)



# 定位用户名输入框，就输入admin
driver.find_element_by_css_selector("#userA").send_keys("admin")

sleep(3)
driver.quit()

# 显示等待
wait = WebDriverWait(driver, 10, 1)
# username = wait.until(lambda x: x.find_element_by_css_selector("#userA"))
# username.send_keys("admin")

username = wait.until(lambda x: x.find_element_by_css_selector("#userA"))
username.send_keys("admin")


sleep(3)
driver.quit()